#ifndef ADVANCEDEDITOR_H
#define ADVANCEDEDITOR_H

#include <QtCore/QMap>
#include "MultiEditor.h"

class QPrintDialog;
class QsciPrinter;
class QWidget;
class QDialog;
class SettingsDialog;
class QMessageBox;
class LexerCenter;
class QPushButton;
class GoToLineWidget;
class FindReplaceWidget;

struct FileInfo
{
	QString filePath;
	QString fileExtenssion;
	QString fileName;
	
	QString fileEncoding;
	QString extenssionForSyntax;
};

class AdvancedEditor : public MultiEditor
{
	Q_OBJECT
	signals:
		void openedFileWithPath(const QString& path);
		void closedFileWithPath(const QString& path);
	public slots:
		void newFile();
		void closeFile(int index);
		void closeCurrentFile();
		void clear();
		int openFile(QString filePath);
		int openFiles(const QStringList& filesPathes = QStringList());
		int saveFile(int index);
		int saveFileAs(int index);
		int saveCurrentFile();
		int saveCurrentFileAs();
		int reloadFile();
		void printFile();
	
		void showSettings();
		void showGoToLineWidget();
		void showFindReplaceWidget();
	
		void setEncoding(const QString& encodingName);
		void setSyntaxForExtenssion(const QString& extenssion);
	public:
		AdvancedEditor(QWidget *parent = 0);
		~AdvancedEditor();
	
		QWidget *getAdvancedEditorView() const;
		
		QStringList getAllOpenedFilePathes();
	
		FileInfo *getFileInfoOfEditor(Editor *editor) const;
	private slots:
		void updateSettings();
		void changeMaximumOfGoToLine();
	private:
		SettingsDialog *settingsDialog;
		LexerCenter *lexerCenter;
		
		GoToLineWidget *goToLineWidget;
		FindReplaceWidget *findReplaceWidget;
		
		QPrintDialog *printDialog;
		QsciPrinter *printer;
	
		QWidget *advancedEditorView;
	
		QMessageBox *saveOrNotDocDialog;
		QPushButton *saveButtonDialog;
		QPushButton *dontSaveButtonDialog;
		QPushButton *cancelButtonDialog;
		
		QMap<Editor *,FileInfo *> openedFiles; 
};

#endif
